/**
 * 选择飘
 * */
var SelectedPiao = cc.Layer.extendEX({
    ctor: function () {
        this._super();
        var modalLayer = new ccui.Layout();
        modalLayer.setBackGroundColorType(ccui.Layout.BG_COLOR_SOLID);
        modalLayer.setBackGroundColor(cc.color('#1A1A1A'));
        modalLayer.setSwallowTouches(true);
        modalLayer.setTouchEnabled(true);
        modalLayer.setContentSize(cc.winSize);
        modalLayer.setAnchorPoint(cc.p(0.5, 0.5));
        modalLayer.x = cc.winSize.width / 2;
        modalLayer.y = cc.winSize.height / 2;
        modalLayer.ignoreAnchorPointForPosition(false);
        modalLayer.setBackGroundColorOpacity(1);
        this.addChild(modalLayer, -1);
        loadFile(this, majiang.res.SelectedPiao_json);
        this.rootNode.x = cc.winSize.width / 2;
        this.rootNode.y = cc.winSize.height / 2;
        this._addTouchListener();
    },

    /**
     * 添加触摸事件
     * @private
     * */
    _addTouchListener: function () {
        var self = this;
        TouchUtil.setOnclickListener(this['_btn_5_piao'], function () {
            network.send(4101, {piao: 5, room_id: gameData.roomId});
        });
        TouchUtil.setOnclickListener(this['_btn_10_piao'], function () {
            network.send(4101, {piao: 10, room_id: gameData.roomId});
        });
        TouchUtil.setOnclickListener(this['_btn_15_paio'], function () {
            network.send(4101, {piao: 15, room_id: gameData.roomId});
        });
        TouchUtil.setOnclickListener(this['_btn_bupiao'], function () {
            network.send(4101, {piao: 0, room_id: gameData.roomId});
            self.removeFromParent();
        });
    }
});